/*
 * server_mgr.h
 *
 *  Created on: Aug 2, 2013
 *      Author: killerg
 */

#ifndef SERVER_MGR_H_
#define SERVER_MGR_H_

#include "server_session.h"

struct server_info_t {
    int32_t serverid;
    co::EServerStatus status;
    std::string name;
    std::string ip;
    int32_t port;
    server_session_t* sess;
    bool new_server;

    server_info_t() {
        serverid = -1;
        status = co::ESS_Down;
        name = "";
        port = -1;
        ip = "";
        sess = NULL;
        new_server = false;
    }
};

struct server_mgr {
    std::vector<server_info_t> info;
    int32_t maxid = -1;

    server_mgr(): info(1000) {
        for (auto i=0u; i<info.size(); ++i)
            info[i].serverid = i;
    }

    bool is_valid_serverid(int32_t serverid) {
        int32_t size = info.size();
        if (serverid >= size || serverid < 0)
            return false;

        return true;
    }
};

#endif /* SERVER_MGR_H_ */
